﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using Manager;
namespace HealthSystem.ReportPage
{
    public partial class Report2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ReportManager manager = new ReportManager();
            string rid = Request["rid"] as string;
            string tjnd = Request["tjnd"] as string + "1";
            string schooltype = Request["schooltype"] as string;
            string districtid = Request["districtid"] as string;
            //ParameterFields paraFields = new ParameterFields();
            //ParameterField[] paraField = new ParameterField[2];
            //ParameterDiscreteValue[] discreteValue = new ParameterDiscreteValue[2];
            ////ParameterRangeValue rangeValue = new ParameterRangeValue();
            //paraField[0] = new ParameterField();
            //paraField[0].ParameterFieldName = "SchoolStyle";
            //discreteValue[0] = new ParameterDiscreteValue();
            //discreteValue[0].Value = "全部";
            //paraField[0].CurrentValues.Add(discreteValue[0]);

            //paraField[1] = new ParameterField();
            //paraField[1].ParameterFieldName = "term";
            //discreteValue[1] = new ParameterDiscreteValue();
            //discreteValue[1].Value = "2009年";
            //paraField[1].CurrentValues.Add(discreteValue[1]);
            //foreach (ParameterField pf in paraField)
            //{
            //    paraFields.Add(pf);
            //}


            var Report_TB_Grade = manager.GetReport(rid, tjnd, schooltype, districtid);
            ReportDocument rd = new ReportDocument();
            var path = Server.MapPath("~") + "Reports\\rpt_Sgtz.rpt";
            rd.Load(path);
            //rd.SetDataSource(Report_TB_Grade.Tables[0]);
            CrystalReportViewer1.ReportSource = rd;
            //CrystalReportViewer1.ParameterFieldInfo = paraFields;
            //CrystalReportViewer1.DataBind();
            CrystalReportViewer1.Visible = true;
        }
    }
}